<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <button id="btn">致命隧道</button>

    <script>
        function throttle(fn, delay) {
            let timer = null;
            return function () {
                if(flag){
                    flag = false;
                    timer = setTimeout(()=>{
                        fn();
                        flag = true;
                    }, delay)
                }
            }
        }

        let flag = true;
        let btn = document.getElementById('btn');
        btn.onclick = throttle(()=>{
            console.log('点击了')
        }, 1000)

    </script>
</body>
</html>